#!/bin/bash
set -e

while getopts  ":p:h" opts
do
        case  $opts  in
		h)
		echo `basename $0` '<in [in2 ...]>'
		exit 1
		;;
		p)
		out_prefix=$OPTARG
		;;
		\?)
		echo `basename $0` ': invalid option.'
		exit 1
		;;
		esac
done
shift $(($OPTIND - 1))

if [ -z "$1" ]; then
	echo `basename $0` '<in [in2 ...]>'
	exit 1
fi

# -----------------------------------------------
# -----------------------------------------------
. /mnt/ilustre/app/medical/tools/.var #----------
# -----------------------------------------------

t_name=('Summary' 'Gene-summary' 'High-confidence variants' 'Low-confidence variants')

cat $tools_path/script/head.txt >snp.html

# for i in $(seq $#); do
# echo '<h2>'${t_name[i]}'</h2>' >>snp.html
# div.pl $ >>snp.html
# done
i=0
for input; do

# paste 2.index.txt $input > $input.ind

echo '<h2>'${t_name[$((i++))]}'</h2>' >>snp.html
div.pl $input >>snp.html
done

cat snp.html $tools_path/script/snp_note.txt $tools_path/script/foot.txt > $out_prefix.html

rm snp.html